/*
 * ReaderTester.java
 *
 * Created on 5 de Dezembro de 2007, 15:03
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package importadorDXF;

/**
 *
 * @author rafaelbuck
 */
public class DxfSTYLE extends DxfTable
{

    /** Creates a new instance of DxfSTYLE */
    public DxfSTYLE()
    {
        aspect = 1.0F;
        super.name = "STANDARD";
        fontName = "TXT8";
    }

    public boolean setGroup(short grpNr, int ival)
    {
        switch(grpNr)
        {
        case 71: // 'G'
            direction = (short)ival;
            return true;
        }
        return super.setGroup(grpNr, ival);
    }

    public boolean setGroup(short grpNr, String str)
    {
        switch(grpNr)
        {
        case 3: // '\003'
            fontName = str.toUpperCase();
            int dot = fontName.lastIndexOf('.');
            if(dot != -1)
                fontName = fontName.substring(0, dot);
            return true;

        case 4: // '\004'
            bigFontName = str;
            return true;
        }
        return super.setGroup(grpNr, str);
    }

    public boolean setGroup(short grpNr, float fval)
    {
        switch(grpNr)
        {
        case 40: // '('
            height = fval;
            return true;

        case 41: // ')'
            aspect = fval;
            return true;

        case 50: // '2'
            slant = (float)(((double)fval / 180D) * 3.1415926535897931D);
            return true;
        }
        return super.setGroup(grpNr, fval);
    }

    public boolean finishRead(DxfFile file)
    {
        return true;
    }

    public final String getFontName()
    {
        return fontName;
    }

    public static final short STYLE_VERTICAL = 4;
    public static final short STYLE_USED = 64;
    public static final String STANDARD = "STANDARD";
    public static final String DEFAULT_FONT = "TXT8";
    protected float height;
    protected float aspect;
    protected float slant;
    protected float lastHeight;
    protected short direction;
    protected String fontName;
    protected String bigFontName;
}